
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet

from goods.models import SKUImage, SKU
from meiduo_admin.serializer.image import SPUImageSerializer, SKUSerializer
from meiduo_admin.utils import UserPageNum


class ImageView(ModelViewSet):

    # 指定分页器
    pagination_class = UserPageNum
    # 指定序列化器
    serializer_class = SPUImageSerializer
    queryset = SKUImage.objects.all()

    # 获取关联的sku表数据
    def simple(self,request):
        data = SKU.objects.all()
        ser = SKUSerializer(data,many=True)
        return Response(ser.data)







